MyGame.s7 = function(game) {
	
	

};


MyGame.s7.prototype = {
    create: function() {
    	
        var that = this;
    	
		console.log('s7-woshi')

        game.bg = game.add.image(0,0,'s7_bg');


        game.cl = game.add.image(362,310,'cl_0');

       
       
        game.light = game.add.graphics(0, 0);
        game.light.beginFill(0x000000,.7);
        game.light.drawRect(0, 0, game.world.width,game.world.height);
        game.light.endFill();


        


        game.s7_text_1 = game.add.image(114,753,'s7_text_1');
        game.s7_text_1.alpha = 0;

        
        game.s7_text_2 = game.add.image(457,166,'s7_text_2');
        game.s7_text_2.alpha = 0;


        game.s7_text_3 = game.add.image(122,453,'s7_text_3');
        game.s7_text_3.alpha = 0;



        game.time.events.add(Phaser.Timer.SECOND * 2, function(){
            GameUI.touch(200,730,function(){
                game.touch1.kill();
                game.touch2.kill();
                that.light_up()
            })
        }, this);


        

       

        

        GameUI.cutscenes()


  

    },

    light_up : function(){
        var that = this;

        var i = 1;

        game.time.events.loop(Phaser.Timer.SECOND/10, function(){
            if(i>=18){
                return;
            }
            i++
            game.cl.loadTexture('cl_'+i+'', 0, false);
        }, this);


        game.add.tween(game.light).to({alpha:0},2000,Phaser.Easing.Linear.None,true,0).onComplete.add(function(){
           that.showText()
        },this)
    },

    showText : function(){

        var isTouch = false;

        game.add.tween(game.s7_text_1).to( { alpha: 1}, 2000, Phaser.Easing.Cubic.Out, true, 1000)
        game.add.tween(game.s7_text_2).to( { alpha: 1}, 2000, Phaser.Easing.Cubic.Out, true, 1500)
        game.add.tween(game.s7_text_3).to( { alpha: 1}, 2000, Phaser.Easing.Cubic.Out, true, 2000).onComplete.add(function(){


            game.input.onTap.add(function(){
                game.state.start('s8')
                isTouch = true;
            }, this);


            game.time.events.add(Phaser.Timer.SECOND * 4, function(){
                if(!isTouch){
                    game.state.start('s8')
                }
            }, this);
        },this)

    },
    

    update: function() {
    	
    	
    	
    },
    
    
    
    render : function(){
    	/*game.obstacles.forEach(function(item){
            game.debug.body(item);
        })
    	game.debug.body(game.player);*/
    }
};

